/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.eisti.icc.zk;

import fr.eisti.icc.client.ClientBibliotheque;
import com.sun.jersey.api.client.ClientResponse;
import fr.eisti.icc.data.Emprunteur;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Button;
import org.zkoss.zul.Div;
import org.zkoss.zul.East;
import org.zkoss.zul.Image;
import org.zkoss.zul.Label;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.West;
import org.zkoss.zul.Window;

/**
 *
 * @author clion
 */
public class CreerEmprunt extends GenericForwardComposer {
private Window creationEmprunt;
    private Textbox loginEmprunteur;
    private Textbox documentAPreter;
    private Textbox duree;
    private Textbox cheque;
 private Listbox listboxEmprunts;
    private Listbox listboxReservations;
    public void onClick$preter() {
        final ClientBibliotheque cl = new ClientBibliotheque();
        ClientResponse r = cl.annulerReservation_XML(documentAPreter.getValue());
        if (r.getStatus() == 200) {
            r = cl.preterDocument_XML(documentAPreter.getValue(), loginEmprunteur.getValue(), cheque.getValue());

            if (r.getStatus() == 200) {
            } else {
                Messagebox.show(r.toString());
            }


        } else {
            Messagebox.show(r.toString());
        }
        Messagebox.show(listboxEmprunts.toString());
        creationEmprunt.detach();
        ListEmprunts.refresh(listboxEmprunts,listboxReservations);
    }
}
